package jdbc;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * 创建一张表article
 * 表结构
 * id 整数结构类型,主键,自增     唯一标识
 * title 字符串类型 ,长度200个字符 , 文章标题
 * content 字符串类型,长度1000个字符  文章正文
 */
public class Test {
    public static void main(String[] args) {
        try (
                Connection conn = DBUtil.getConnection();
        ) {
            Statement stmt = conn.createStatement();
            String sql = "CREATE TABLE article(" +
                    "id int primary key auto_increment," +
                    "title varchar(200)," +
                    "content varchar(1000)" +
                    ")";
            stmt.execute(sql);
            System.out.println("表创建成功");
            conn.close();
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}
